﻿CREATE PROCEDURE [dbo].[MemberUpdate]
	@customerId				INT,
	@MemberId				INT,
	@userName				VARCHAR(8),
	@password				VARCHAR(8),
	@roleId					INT,
	@firstName				VARCHAR(50),
	@lastName				VARCHAR(50),		
	@gender					CHAR(1),
	@dateOfBirth			DATE,
	@passportNo				VARCHAR(20),
	@address1				VARCHAR(50),
	@address2				VARCHAR(50),
	@address3				VARCHAR(50),
	@city					VARCHAR(10),
	@postalCode				VARCHAR(10),
	@country				VARCHAR(50),	
	@passportExpiryDate		DATE,
	@memberPoints			INT
AS
BEGIN

	UPDATE	[dbo].[Customers]
	SET     [UserName] = @userName,
			[Password] = @password,
			[RoleId] = @roleId, 
			[FirstName] = @firstName, 
			[LastName] = @lastName, 
			[Gender] = @gender, 
			[DateOfBirth] = @dateOfBirth
    WHERE	[CustomerId] = @customerId;

	UPDATE	[dbo].[Members]
	SET		[PassportNo] = @passportNo,
			[Address1] = @address1, 
			[Address2] = @address2, 
			[Address3] = @address3, 
			[City] = @city, 
			[PostalCode] = @postalCode, 
			[Country] = @country, 
			[PassportExpiryDate] = @passportExpiryDate, 
			[MemberPoints] = @memberPoints
	WHERE	[CustomerId] = @customerId;

END